index.html.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation1></HomePageNavigation1>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <!-- 资讯列表 -->
  23. <div class="newsDetail">
  24. <div class="inner">
  25. <div class="innerLeft">
  26. <div class="leftBottomTitle">{{ newsDetail.con_title }}</div>
  27. <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content"></div>
  28. </div>
  29. <div class="innerRight">
  30. <div class="rightMenuTitle">导航列表</div>
  31. <ul>
  32. <li v-for="(item, index) in bottomMenu" :key="index">
  33. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  34. v-if="item.id == pageId && item.id != 7" class="active">
  35. {{ item.name }}
  36. </NuxtLink>
  37. <NuxtLink :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  38. v-else-if="item.id != pageId && item.id != 7">
  39. {{ item.name }}
  40. </NuxtLink>
  41. <NuxtLink :to="`/about/${item.name_pinyin}/list-1.html`" :title="item.name"
  42. v-if="item.id == 7 && pageId == 7 && routeHref == '/specialList/7'" class="active">
  43. {{item.name }}
  44. </NuxtLink>
  45. <NuxtLink :to="`/about/${item.name_pinyin}/list-1.html`" :title="item.name" v-else-if="item.id == 7">
  46. {{ item.name}}
  47. </NuxtLink>
  48. </li>
  49. </ul>
  50. </div>
  51. <div style="clear: both;"></div>
  52. </div>
  53. </div>
  54. <!-- 广告二 -->
  55. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  56. <!-- 页面底部 -->
  57. <HomeFoot1></HomeFoot1>
  58. </template>
  59. <script setup>
  60. //1.页面依赖 start ---------------------------------------->
  61. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  62. import { ArrowRight } from '@element-plus/icons-vue'
  63. import { ref, onMounted } from 'vue';
  64. //获得跳转过来的id
  65. const route = useRoute();
  66. //获得当前的完整路径
  67. const fullPath = route.path;
  68. //拆分,取出来中间这一段,然后提取数字部分
  69. const segments = fullPath.split('/');
  70. const targetSegment = segments[2];
  71. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  72. let articleId;
  73. let pageId;
  74. //通过导航路径反向查询导航id
  75. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  76. method: 'GET',
  77. query: {
  78. 'foot_pinyin': targetSegment,
  79. },
  80. });
  81. if(getRouteId.code == 200){
  82. articleId = getRouteId.data.id;
  83. pageId = getRouteId.data.id;
  84. }else{
  85. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  86. console.log("错误位置:通过url路径查询导航池id")
  87. console.log("后端错误反馈:",getRouteId.message)
  88. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  89. }
  90. //1.页面依赖 end ---------------------------------------->
  91. //2.页面数据 start ---------------------------------------->
  92. //广告列表
  93. const adList = ref([]);
  94. let adImg1 = ref([]);
  95. let adImg2 = ref([]);
  96. async function getAdData(){
  97. const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'PAGE'}});
  98. adList.value = adData.data;
  99. if(adData.code==200){
  100. for(let item of adData.data){
  101. if(item.ad_tag == 'PAGE_0001'){
  102. adImg1.value = item;
  103. }
  104. if(item.ad_tag == 'PAGE_0002'){
  105. adImg2.value = item;
  106. }
  107. }
  108. }else{
  109. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  110. console.log("错误位置:获取详情页广告列表")
  111. console.log("后端错误反馈:",adData.message)
  112. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  113. }
  114. }
  115. getAdData();
  116. const newsDetail = ref({})
  117. const bottomMenu = ref([]);
  118. async function getPageData() {
  119. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  120. method: 'GET',
  121. query: {
  122. 'fcat_id': articleId
  123. },
  124. });
  125. newsDetail.value = mkdata.data;
  126. }
  127. getPageData();
  128. async function getPageMenu() {
  129. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  130. method: 'GET',
  131. query: {},
  132. });
  133. bottomMenu.value = mkdata.data;
  134. }
  135. getPageMenu();
  136. //2.页面数据 end ---------------------------------------->
  137. //4.设置seo信息 start---------------------------------------->
  138. //4.1 设置seo信息
  139. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  140. method: 'GET',
  141. query: {},
  142. });
  143. let seoTitle = setData.data.website_head.title;
  144. let seoDescription = setData.data.website_head.description;
  145. let seoKeywords = setData.data.website_head.keywords;
  146. let seoSuffix = setData.data.website_head.suffix;
  147. let seoName = setData.data.website_head.website_name;
  148. useSeoMeta({
  149. title: seoTitle + "_" + seoSuffix,
  150. meta: [
  151. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  152. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix , tagPriority: 10 }
  153. ]
  154. });
  155. //4.设置seo信息 end---------------------------------------->
  156. onMounted(async () => {
  157. //从客户端获取行政职能部门 加快打开速度
  158. const { $webUrl, $CwebUrl } = useNuxtApp();
  159. //广告1
  160. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_0001`
  161. const responseAd1 = await fetch(url, {
  162. headers: {
  163. 'Content-Type': 'application/json',
  164. 'Userurl': $CwebUrl,
  165. 'Origin': $CwebUrl
  166. }
  167. });
  168. const resultAd1 = await responseAd1.json();
  169. adImg1.value = resultAd1.data[0];
  170. //广告2
  171. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_0002`
  172. const responseAd2 = await fetch(url2, {
  173. headers: {
  174. 'Content-Type': 'application/json',
  175. 'Userurl': $CwebUrl,
  176. 'Origin': $CwebUrl
  177. }
  178. });
  179. const resultAd2 = await responseAd2.json();
  180. adImg2.value = resultAd2.data[0];
  181. })
  182. </script>
  183. <style lang="less" scoped>
  184. //导航条
  185. .breadcrumb {
  186. width: 100%;
  187. height: 22px;
  188. margin-bottom: 30px;
  189. font-family: Microsoft YaHei, Microsoft YaHei;
  190. font-weight: 400;
  191. font-size: 20px;
  192. color: #666666;
  193. line-height: 23px;
  194. text-align: left;
  195. font-style: normal;
  196. text-transform: none;
  197. .el-breadcrumb::v-deep {
  198. display: inline-block;
  199. vertical-align: -4px;
  200. }
  201. /deep/.el-breadcrumb__inner a,
  202. /deep/.el-breadcrumb__inner.is-link {
  203. color: #666666;
  204. font-weight: 400;
  205. text-decoration: none;
  206. transition: var(--el-transition-color);
  207. }
  208. span {
  209. font-family: Microsoft YaHei, Microsoft YaHei;
  210. font-weight: 400;
  211. font-size: 20px;
  212. color: #666666;
  213. line-height: 23px;
  214. text-align: left;
  215. font-style: normal;
  216. text-transform: none;
  217. }
  218. span:hover {
  219. color: #666666;
  220. }
  221. .location {
  222. margin-right: 20px;
  223. width: 100px;
  224. height: 22px;
  225. font-family: Microsoft YaHei, Microsoft YaHei;
  226. font-weight: 400;
  227. font-size: 20px;
  228. color: #666666;
  229. line-height: 23px;
  230. text-align: left;
  231. font-style: normal;
  232. text-transform: none;
  233. }
  234. }
  235. // 资讯列表
  236. .newsDetail {
  237. width: 100%;
  238. //height: 1400px;
  239. margin-bottom: 70px;
  240. .inner {
  241. width: 1200px;
  242. //height: 1400px;
  243. font-size: 16px;
  244. .innerLeft {
  245. //height: 1400px;
  246. float: right;
  247. .LeftTop {
  248. //height: 522px;
  249. margin-top: 50px;
  250. >h1 {
  251. line-height: 40px;
  252. margin-bottom: 30px;
  253. font-family: Microsoft YaHei, Microsoft YaHei;
  254. font-weight: bold;
  255. font-size: 30px;
  256. color: #333333;
  257. }
  258. >p {
  259. height: 18px;
  260. line-height: 18px;
  261. font-family: Microsoft YaHei, Microsoft YaHei;
  262. font-weight: 400;
  263. font-size: 14px;
  264. color: #999999;
  265. span {
  266. margin-right: 40px;
  267. }
  268. }
  269. >img {
  270. width: 680px;
  271. height: 382px;
  272. padding: 50px 0px 60px 55px;
  273. }
  274. }
  275. .leftBottomTitle {
  276. color: #028E21;
  277. font-size: 24px;
  278. font-weight: bold;
  279. height: 60px;
  280. line-height: 60px;
  281. }
  282. .leftBottom {
  283. width: 790px;
  284. font-size: 20px;
  285. border-top: 1px solid #139602;
  286. padding-top: 40px;
  287. >h3,
  288. >p {
  289. text-indent: 2em;
  290. width: 790px;
  291. font-family: Microsoft YaHei, Microsoft YaHei;
  292. font-size: 20px;
  293. color: #333333;
  294. line-height: 23px;
  295. padding-bottom: 30px;
  296. }
  297. >h3 {
  298. font-weight: 600px;
  299. }
  300. >p {
  301. font-weight: 400;
  302. }
  303. }
  304. }
  305. .innerRight {
  306. width: 279px;
  307. .rightMenuTitle {
  308. width: 279px;
  309. height: 69px;
  310. font-size: 22px;
  311. font-weight: bold;
  312. line-height: 58px;
  313. text-align: center;
  314. color: #fff;
  315. background: url("http://img.bjzxtw.org.cn/master/bjzxtw/public/special/projectMoreTitle.png") no-repeat;
  316. margin-bottom: 30px;
  317. }
  318. ul {
  319. li {
  320. a {
  321. border-left: 5px solid #028E21;
  322. margin-bottom: 15px;
  323. font-size: 22px;
  324. display: block;
  325. height: 61px;
  326. line-height: 61px;
  327. color: #333333;
  328. text-align: center;
  329. background: #FBFBFB;
  330. }
  331. }
  332. }
  333. .active {
  334. border-left: 0;
  335. border: 1px solid #028E21;
  336. background: #fff;
  337. }
  338. }
  339. }
  340. }
  341. </style>